import { createRenderer } from "./renderer"
import { renderDOMOption } from "./dom"
import { ShapeFlag } from './flags'
import { createVNode } from "./vnodes/vnode"
import type { vnode } from "../types"


export function h(tag:keyof HTMLElementTagNameMap):vnode
export function h(tag:keyof HTMLElementTagNameMap, props:vnode['props']):vnode
export function h(tag:keyof HTMLElementTagNameMap, props:vnode['props'], children:(string|vnode)[]):vnode
export function h(tag:keyof HTMLElementTagNameMap, props:vnode['props']={}, children:(string|vnode)[]=[]) {
  return {
    tag,
    props,
    children
  }
}

export function createApp(rootComponent:unknown) {
  const app =createRenderer(renderDOMOption).createApp(rootComponent)

  app.mount = function(containerOrSelector:string|HTMLElement) {
    

  }

  return app
}

export function getCurrentInstance() {
  if(window.currentInstance) return window.currentInstance
}
